import React from 'react'
import ReactDOM from 'react-dom';

import {   createHashHistory } from 'History'
import { Router, Route, useRouterHistory } from 'react-router'

import { syncHistoryWithStore, RouterStore } from 'mobx-react-router';

import { Provider } from 'mobx-react';

import Gov from 'weaInfo' 
const InfoStore = Gov.store;
const InfoRoute = Gov.Route;

const routingStore = new RouterStore();

const browserHistory = useRouterHistory(createHashHistory)({
    queryKey: '_key',
    basename: '/'
});

const history = syncHistoryWithStore(browserHistory, routingStore);
window.weaHistory = history;

let store = {
    routing: routingStore,
    ...InfoStore
}

const Home = props => props.children;

class Root extends React.Component {
   
    render() {
        return (
            <Provider ecId={`${this && this.props && this.props.ecId || ''}_Provider@fzxmj7`} {...store}>
                <Router ecId={`${this && this.props && this.props.ecId || ''}_Router@3adnbl`} history={history}>
                    <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@pge5j4`} name="main" breadcrumbName="入口" path="main" component={Home}>
                    {InfoRoute}
                    </Route>
                </Router>
            </Provider>
        )
    }
}

ReactDOM.render(<Root ecId={`${this && this.props && this.props.ecId || ''}_Root@ojuc5g`} />, document.getElementById('container'));